package com.bix.util.blizfiles.m2;

import java.nio.ByteBuffer;

import com.bix.util.blizfiles.BufferUtils;
import com.jme.math.Vector3f;

/**
 * TODO:  THIS IS NOT DONE!!!!!!
 * 
 * @author squid
 *
 */
public class M2RibbonEmitter {
	private	int								unknown;
	private	int								boneId;
	private	Vector3f					position; // Relative to bone.
	private	M2CountOffsetPair	textures;
	private	M2CountOffsetPair	unknown2;
	private	M2Color						color;
	private	float							above;
	private	float							below;
	private	float							resolution;
	private	float							lifespan;
	private	float							unknown3;
	private	short[]						unknown4 = new short[2];
	private	int[]							unknown5 = new int[2];
	private	int[]							unknown6 = new int[2];
	
	public M2RibbonEmitter () {
	}
	
	public M2RibbonEmitter (ByteBuffer bb) {
		this.read (bb);
	}
	
	public void read (ByteBuffer bb) {
		int	position = bb.position();
		
		this.unknown		= bb.getInt ();
		this.boneId			= bb.getInt ();
		this.position		= BufferUtils.getVector3f(bb);
		this.textures		= new M2CountOffsetPair (bb);
		this.unknown2		= new M2CountOffsetPair (bb);
		this.color			= new M2Color (bb);
		this.above			= bb.getFloat();
		this.below			= bb.getFloat();
		this.resolution	= bb.getFloat();
		this.lifespan		= bb.getFloat();
		this.unknown3		= bb.getFloat();
		
		for (int i = 0; i < this.unknown4.length; i++) {
			this.unknown4[i] = bb.getShort();
		}
		
		for (int i = 0; i < this.unknown5.length; i++) {
			this.unknown5[i] = bb.getInt ();
		}
		
		for (int i = 0; i < this.unknown6.length; i++) {
			this.unknown6[i] = bb.getInt ();
		}
		
		
		bb.position(position + 0x9C);
	}

	/**
	 * @return the unknown
	 */
	public int getUnknown() {
		return unknown;
	}

	/**
	 * @return the boneId
	 */
	public int getBoneId() {
		return boneId;
	}

	/**
	 * @return the position
	 */
	public Vector3f getPosition() {
		return position;
	}

	/**
	 * @return the textures
	 */
	public M2CountOffsetPair getTextures() {
		return textures;
	}

	/**
	 * @return the unknown2
	 */
	public M2CountOffsetPair getUnknown2() {
		return unknown2;
	}

	/**
	 * @return the color
	 */
	public M2Color getColor() {
		return color;
	}

	/**
	 * @return the above
	 */
	public float getAbove() {
		return above;
	}

	/**
	 * @return the below
	 */
	public float getBelow() {
		return below;
	}

	/**
	 * @return the resolution
	 */
	public float getResolution() {
		return resolution;
	}

	/**
	 * @return the lifespan
	 */
	public float getLifespan() {
		return lifespan;
	}

	/**
	 * @return the unknown3
	 */
	public float getUnknown3() {
		return unknown3;
	}

	/**
	 * @return the unknown4
	 */
	public short[] getUnknown4() {
		return unknown4;
	}

	/**
	 * @return the unknown5
	 */
	public int[] getUnknown5() {
		return unknown5;
	}

	/**
	 * @return the unknown6
	 */
	public int[] getUnknown6() {
		return unknown6;
	}
}
